package com.atguigu.lease.common.util;

import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PhoneValidateUtil {
    private static final Pattern mobile_pattern =
        Pattern.compile("^(((13\\d)|(14[579])|(15([0-3]|[5-9]))|(166)|(17[0135678])|(18\\d)|(19[89]))\\d{8})$");

    public static boolean isMobile(String mobile) {
        if (StringUtils.isEmpty(mobile)){
            return false;
        }
        Matcher matcher = mobile_pattern.matcher(mobile);
        return matcher.matches();
    }

    //    public static void main(String[] args) {
    //        System.out.println(PhoneValidateUtil.isMobile("13511111111"));
    //        System.out.println(PhoneValidateUtil.isMobile("15411111111"));
    //        System.out.println(PhoneValidateUtil.isMobile("16611111111"));
    //        System.out.println(PhoneValidateUtil.isMobile("17711111111"));
    //    }
}